package com.siants.util;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * Created by yanxin on 2017/7/7.
 */
public class Property {

    public Properties readProperty(){
        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("base.properties");
        Properties p = new Properties();
        try {
            p.load(inputStream);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return p;
    }

    public Properties readProperty(String propertyName){
        Properties p = new Properties();
        try {
            p.load(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(propertyName),"UTF-8"));
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return p;
    }

    public static void main(String[] args) {
        Property property = new Property();
        property.readProperty();
    }

}
